<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="UTF-8"/>
    <title>系统运行日志</title>
    <meta name="renderer" content="webkit"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
    <link rel="stylesheet" href="../layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="../style/admin.css" media="all"/>
    <link rel="stylesheet" href="../style/home.css" media="all"/>
    <style type="text/css">
        html,
        body {
            width: 100%;
            height: 100%;
            margin: 0px;
            padding: 0px;
            border: 0px;
            overflow: hidden;
            /* overflow-x: scroll; */
        }

        .layui-input {
            height: 28px;
        }
    </style>
</head>

<body layadmin-themealias="default">
<div class="layui-fluid">
    <div class="layui-card" style="height: 100%">
        <div class="layui-card-header font20">系统运行日志</div>
        <div class="layui-card-body" style="height: calc(100% - 63px)">
            <blockquote class="layui-elem-quote-sm" id="toolBar" style="padding: 1px 10px;">
                <div class="layui-inline" style="margin-bottom: 0px;">
                    <label class="layui-form-label" style="width: 50px;">日期</label>
                    <div class="layui-input-inline" style="padding-top: 5px; width: 150px;">
                        <input type="text" id="stime" name="stime" autocomplete="off" class="layui-input">
                    </div>
                </div>
            </blockquote>
            <div class="layui-fluid" style="margin-top: 10px; padding:0px; height: calc(100% - 50px); overflow: auto">
                <pre id="logInfo" class="layui-code" style="margin: 0px 0px">
                </pre>
            </div>
        </div>
    </div>
</div>
<script src="../layui/dasui.js">
    <script type="text/javascript" src="../js/lib/watermark.js"></script>
<script>
    layui.use(['code', 'laydate'], function () {
        var $ = layui.$;
        var laydate = layui.laydate;

        layui.code({
            elem: '#logInfo',
            title: "系统运行日志",
            skin: 'notepad',
            about: false,
        });

        laydate.render({
            elem: '#stime',
            type: 'date',
            value: new Date(),
            done: function (value) {
                getRuntimeLog(value);
            }
        });

        getRuntimeLog($("#stime").val());

        function getRuntimeLog(date) {
            let div = document.getElementById('logInfo');
            $.ajax({
                url: './getRuntimeLog', //url
                dataType: 'json', //数据格式
                type: 'POST', //请求方式
                async: true, //是否异步请求
                data: {date: date},
                success: function (result) {
                    if (result.status == 0 || result.status == 200) {
                        div.innerHTML = result.data;
                    } else {
                        div.innerHTML = "</br>";
                        parent.layer.alert(result.message, {icon: 2});
                    }
                },
            });
        }

    });

</script>
</body>

</html>